package com.ww.learn

fun printWhatToDo(dayOfWeek: Any) {
    // 将when用作语句
    when (dayOfWeek) {
        "Saturday", "Sunday" -> println("Relax")
        in listOf("Monday", "Tuesday", "Wednesday", "Thursday") -> println("Work hard")
        in 2..4 -> println("Work hard")
        "Friday" -> println("Party")
        is String -> println("What?")
        else -> println("No clue")
    }
}

fun main() {
    printWhatToDo("Sunday") // Relax
    printWhatToDo("Wednesday") // Work hard
    printWhatToDo(3) // Work hard
    printWhatToDo("Friday") // Party
    printWhatToDo("Munday") // What?
    printWhatToDo(8) // No clue
}